Skip to content

Conversation

@VGSML
Copy link

@VGSML VGSML commented Nov 4, 2025

Rewrite the Arrow.QueryContext method to use new DuckDB Arrow C-API
Closes #5

@VGSML
Copy link
Author

VGSML commented Nov 4, 2025

Merge after: duckdb/duckdb-go-bindings#39
And bindings versions

@VGSML
Copy link
Author

VGSML commented Nov 4, 2025

@taniabogatsch FYI

@taniabogatsch
Copy link
Collaborator

Thanks! Will have a look once we've released the bindings with the latest changes. 👍

@VGSML VGSML changed the base branch from main to v2.6.0-preview November 16, 2025 13:22
@VGSML VGSML changed the base branch from v2.6.0-preview to main November 17, 2025 10:01
@VGSML
Copy link
Author

VGSML commented Nov 17, 2025

@taniabogatsch Could you take a look this PR? What the sequence to merge it, should I the arrowmapping version increase in the duckdb package before merge or split pr to 2 - arrowmapping changes and the changes in the duckdb package?

@taniabogatsch
Copy link
Collaborator

I think your duckdb-go-bindings changes should already be on main! :)

@taniabogatsch
Copy link
Collaborator

We pushed a release today.

@taniabogatsch taniabogatsch self-requested a review November 17, 2025 18:59
@VGSML
Copy link
Author

VGSML commented Nov 17, 2025

Yes, I sow. I mean arrowmapping package in this repo.

@taniabogatsch
Copy link
Collaborator

ah, I see now! We likely need to bump it in a separate PR - i.e., first one with the new functions in the arrow mapping package, then I can bump that version. 👍

@VGSML
Copy link
Author

VGSML commented Nov 21, 2025

@taniabogatsch Very strange with tests when the go version 1.24 is specified in the go.mod, the tests are failed. I have created an issue to update the go version to 1.25 in the CI and packages. #63

@VGSML
Copy link
Author

VGSML commented Nov 21, 2025

@taniabogatsch I revert transitive dependency versions. The failed tests was fixed
You can merge this PR.

@VGSML
Copy link
Author

VGSML commented Nov 21, 2025

@taniabogatsch Will you merge it?

@taniabogatsch
Copy link
Collaborator

Yes, but I'll need to review it first. 👍 Didn't find the time to take a look yet, will so next week.

Copy link
Collaborator

@taniabogatsch taniabogatsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR / implementation - I saw that its not a huge PR, so I squeezed in a review already ;)

arrow.go Outdated
}
if arrowmapping.ArrowScan(a.conn.conn, name, arrowStream) == mapping.StateError {
release()
return nil, errors.New("duckdb_arrow_scan")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we turn this into a bit more elaborate error? I.e., that something went wrong in the DuckDB-side? Also, can we trigger this in a test? If not, should we tell people to file a bug report if they run into it?

Copy link
Author

@VGSML VGSML Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but this part of the code part is unchanged and here is no method to get the real error in the ArrowScan (I think it should be deprecated in the future). I have added some more informative err message.

I want to add the new type table function - ArrowTableUDF, that will use the new C-API, and deprecated this method. With this new UDF and replacement scan we can provide the same functionality to have arrow view.

The main difference will be in the options to delete the view definition after using. Do you know, the C-API will contain the method to deregister replacement scans and UDFs?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - for replacement scans I don't think its possible to deregister (alter) yet.

For table functions it should be possible (only checked latest main)

duckdb_state duckdb_register_table_function(duckdb_connection connection, duckdb_table_function function) {
	// ...

	try {
		con->context->RunFunctionInTransaction([&]() {
			auto &catalog = duckdb::Catalog::GetSystemCatalog(*con->context);
			duckdb::CreateTableFunctionInfo tf_info(tf);
			tf_info.on_conflict = duckdb::OnCreateConflict::ALTER_ON_CONFLICT;
			catalog.CreateTableFunction(*con->context, tf_info);
		});
	} catch (...) { // LCOV_EXCL_START
		return DuckDBError;
	} // LCOV_EXCL_STOP
	return DuckDBSuccess;
}

@taniabogatsch taniabogatsch added feature / enhancement Code improvements or a new feature dependencies Updates a dependency file labels Nov 22, 2025
@taniabogatsch taniabogatsch added the changes requested Changes have been requested to a PR or issue label Nov 22, 2025
@VGSML
Copy link
Author

VGSML commented Nov 23, 2025

The PR just replaces the internal implementation of the Arrow.QueryContext method and record reader implementation.

I also rename the reader to make it simple.

@VGSML VGSML requested a review from taniabogatsch November 23, 2025 13:26
@taniabogatsch taniabogatsch merged commit f69d600 into duckdb:main Nov 24, 2025
17 checks passed
@taniabogatsch
Copy link
Collaborator

Thanks!

@VGSML
Copy link
Author

VGSML commented Nov 24, 2025

Thanks, will you push the new tag for the duckdb package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes requested Changes have been requested to a PR or issue dependencies Updates a dependency file feature / enhancement Code improvements or a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move to new Arrow C-API

2 participants